////////////////////////////////////////////////////////////////////////////////
//
//	This file is part of Woozox, see <http://code.google.com/p/woozox/>.
//
//	Copyright 2008-2009 Florian David
//
//	Woozoo is free software: you can redistribute it and/or modify
//	it under the terms of the GNU Lesser General Public License as 
//	published by the Free Software Foundation, either version 3 of 
//	the License, or (at your option) any later version.
//
//	Woozoo is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU Lesser General Public 
//	License along with Woozoo. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
package org.woozoo.xhtml.wordpress.base
{
	import org.woozoo.xhtml.core.base.Document;
	import org.woozoo.xhtml.core.base.Element;
	import org.woozoo.xhtml.extended.base.ImgElement;
	import org.woozoo.xhtml.extended.base.LinkElement;
	
	/**
	 * This class represent a user (commenter) from your wordpress blog
	 * */
	public class WPUser extends Element
	{
		/**
		 * 
		 * */
		public var email : String = "";

		/**
		 * 
		 * */
		public var pseudo : String;

		/**
		 * 
		 * */
		public var website : LinkElement;

		/**
		 * 
		 * */
		public var avatar : ImgElement;
		
		/**
		 * 
		 * */
		public function WPUser(document : Document, source : XML = null) {
			super(document, source);
			if (source) {
				var cite : Element = getElementsByTagName('cite')[0] as Element;
				var a : Element = cite.getElementsByTagName('a')[0] as Element;
				if (a) {
					pseudo = a.innerHTML;
					website = new LinkElement(document, a); 
				} else {
					pseudo = cite.innerHTML;
				}
				avatar = new ImgElement(document, getElementsByTagName('img')[0]);
			}
		}
	}
}